home *** CD-ROM | disk | FTP | other *** search
- Path: rcp6.elan.af.mil!rscernix!danpop
- From: danpop@mail.cern.ch (Dan Pop)
- Newsgroups: comp.lang.c
- Subject: Re: sscanf bug??????
- Date: 15 Feb 96 11:41:51 GMT
- Organization: CERN European Lab for Particle Physics
- Message-ID: <danpop.824384511@rscernix>
- References: <4fimvo$82s@fnord.dfw.net> <4frr9j$ie8@fnord.dfw.net> <4ftdnq$b0c@sun001.spd.dsccc.com>
- NNTP-Posting-Host: ues5.cern.ch
- X-Newsreader: NN version 6.5.0 #7 (NOV)
-
- In <4ftdnq$b0c@sun001.spd.dsccc.com> jmccarty@spd.dsccc.com (Mike McCarty) writes:
-
- >In any case, 013196 (octal) is 718 decimal. 718 decimal mod 256 is 206.
-
- Huh??? What algorithm did you use to perform the conversion from octal
- to decimal?
-
- >I don't see anything reasonable it could be the mod of that would
- >result in 89. So even if it is an "undocumented feature" or non-ANSI
- >extension, I don't think it is working properly.
-
- It _is_ working correctly, assuming %i instead of %d. sscanf will stop
- at the first character which cannot be converted, and this is '9'.
- It's very easy to see that 0131 is 89, indeed.
-
- BTW, in C, 013196 is not a valid integer constant and the compiler has to
- emit a diagnostic. Of course, this doesn't apply to "integer constants"
- stored in string literals :-)
-
- Dan
- --
- Dan Pop
- CERN, CN Division
- Email: danpop@mail.cern.ch
- Mail: CERN - PPE, Bat. 31 R-004, CH-1211 Geneve 23, Switzerland
-